<!DOCTYPE html>
<html>
<head>
    <title>模具详情</title>
    #parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak>
    <Card>
        <Tabs value="name0" type="card">
            <Tab-pane label="基础信息" name="name0">
                    <i-form ref="formValidate" :model="moduleArchives" :label-width="100">
                        <Card>
                            <p slot="title">基础信息</p>
                        <Row>
                            <i-col span="6" >
                                <Form-item label="模具编码">
                                    <span>  {{moduleArchives.moduleCode}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6" >
                                <Form-item label="模具号">
                                    <span> {{moduleArchives.moduleNo}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6" >
                                <Form-item label="模具类型">
                                    <span> {{moduleArchives.moduleTypeName}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6" >
                                <Form-item label="模具机型">
                                    <span>  {{moduleArchives.productModelName}}</span>
                                </Form-item>
                            </i-col>
                        </Row>
                        <Row>
                            <i-col span="6">
                                <Form-item label="现场使用码">
                                    <span> {{moduleArchives.liveCode}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6">
                                <Form-item label="底层编码">
                                    <span> {{moduleArchives.lastCode}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6">
                                <Form-item label="模框寿命标准">
                                    <span> {{moduleArchives.lifeStandard}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6">
                                <Form-item label="模框使用次数">
                                    <span>{{moduleArchives.useNo}}</span>
                                </Form-item>
                            </i-col>
                        </Row>
                        <Row>
                            <i-col span="6">
                                <Form-item label="模框剩余次数">
                                    <span>  {{moduleArchives.remainNo}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6">
                                <Form-item label="镶块寿命标准">
                                    <span> {{moduleArchives.xiangkuaiLifeStandard}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6">
                                <Form-item label="镶块使用次数">
                                    <span>  {{moduleArchives.xiangkuaiUseNo}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6">
                                <Form-item label="镶块剩余次数">
                                    <span>  {{moduleArchives.xiangkuaiRemainNo}}</span>
                                </Form-item>
                            </i-col>

                        </Row>
                        <Row>
                            <i-col span="6">
                                <Form-item label="所在车间">
                                    <span>  {{moduleArchives.subShopName}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6">
                                <Form-item label="模具厂家">
                                    <span>  {{moduleArchives.moduleManufacturers}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6">
                                <Form-item label="镶块厂家">
                                    <span>  {{moduleArchives.xiangkuaiManufacturers}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6">
                                <Form-item label="购买时间">
                                    <span>   {{moduleArchives.buyDate}}</span>
                                </Form-item>
                            </i-col>
                        </Row>
                        <Row>
                            <i-col span="6">
                                <Form-item label="量产时间">
                                    <span>   {{moduleArchives.volumeProductionDate}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6">
                                <Form-item label="启用时间">
                                    <span>   {{moduleArchives.startDate}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6">
                                <Form-item label="固资编号">
                                    <span> {{moduleArchives.firmCapitalNo}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6">
                                <Form-item label="是否有资料">
                                    <span> {{moduleArchives.isData=='0'?'否':'是'}}</span>
                                </Form-item>
                            </i-col>
                        </Row>
                        <Row>
                            <i-col span="6">
                                <Form-item label="当前状态">
                                    <span>  {{moduleArchives.currentState}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6">
                                <Form-item label="模具类别">
                                    <span>   {{moduleArchives.moduleCategory}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6">
                                <Form-item label="模具系列">
                                    <span>   {{moduleArchives.moduleSeries}}</span>
                                </Form-item>
                            </i-col>
                            <i-col span="6">
                                <Form-item label="启用时间">
                                    <span>   {{moduleArchives.moduleSeries}}</span>
                                </Form-item>
                            </i-col>
                        </Row>
                        </Card>
                        <Card>
                            <p slot="title">验收状况</p>
                          <Row>
                              <i-col span="6">
                                  <Form-item label="初验收时间">
                                      <span>   {{moduleArchives.initialAcceptDate}}</span>
                                  </Form-item>
                              </i-col>
                              <i-col span="12" :offset="6">
                                  <Form-item label="初验收状况">
                                      <span>   {{moduleArchives.initialAcceptRemark}}</span>
                                  </Form-item>
                              </i-col>
                          </Row>
                            <Row>
                                <i-col span="6">
                                    <Form-item label="终验收时间">
                                        <span>   {{moduleArchives.finalAcceptDate}}</span>
                                    </Form-item>
                                </i-col>
                                <i-col span="12" :offset="6" >
                                    <Form-item label="终验收状况">
                                        <span>   {{moduleArchives.finalAcceptRemark}}</span>
                                    </Form-item>
                                </i-col>
                            </Row>
                        </Card>
                        <Card>
                            <p slot="title">主要变更履历</p>
                            <Row>
                                <i-col span="24" >
                                    <Form-item label="主要变更履历">
                                        <span>   {{moduleArchives.majorChangeHistory}}</span>
                                    </Form-item>
                                </i-col>
                            </Row>
                        </Card>
                        <Card>
                            <Row>
                                <i-col span="6">
                                    <Form-item label="报废时间">
                                        <span>   {{moduleArchives.scrapDate}}</span>
                                    </Form-item>
                                </i-col>
                                <i-col span="24" >
                                    <Form-item label="模具报废时状况">
                                        <span>   {{moduleArchives.scrapRemark}}</span>
                                    </Form-item>
                                </i-col>
                            </Row>
                        </Card>
                    </i-form>
            </Tab-pane>
            <Tab-pane label="模具资料" name="name2">
                <table id="jqGrid1"></table>
            </Tab-pane>
            <Tab-pane label="维护履历" name="name4">
                <table id="jqGrid2"></table>
            </Tab-pane>
            <Tab-pane label="维修履历" name="name5">
                <table id="jqGrid3"></table>
            </Tab-pane>
            <Tab-pane label="型芯镶件更换" name="name6">
                <table id="jqGrid4"></table>
            </Tab-pane>
            <Tab-pane label="车间变更记录" name="name7">
                <table id="jqGrid5"></table>
            </Tab-pane>
            <!--  <Tab-pane label="寿命情况" name="name6">
                  <table id="jqGrid5"></table>
              </Tab-pane>-->
        </Tabs>
    </Card>
</div>

<script>
    var id = getQueryString("id");
    var moduleCode = getQueryString("moduleCode");
    var moduleTypeName = decodeURI(getQueryString("moduleTypeName")) == null || decodeURI(getQueryString("moduleTypeName")) == 'null' ? '' : decodeURI(getQueryString("moduleTypeName"));
    /**
     * 基础信息
     */
    $(function () {
        vm.getInfo()
    });
    /**
     * 模具资料
     */
    $(function () {
        $("#jqGrid1").Grid({
            url: '../ermsfile/moduleList?moduleType=2&moduleId=' + id,
            multiselect: false,
            colModel: [
                {label: '资料类别', name: 'typeName', index: 'TYPE_NAME', width: 60},
                {label: '附件标题', name: 'fileName', index: 'FILE_NAME', width: 60},
                {label: '附件名称', name: 'relName', index: 'REL_NAME', width: 60},
                {label: '上传用户', name: 'uploaderName', index: 'NICK_NAME', width: 60},
                {
                    label: '上传日期', name: 'createDate', index: 'CREATE_DATE', width: 80, formatter: function (value) {
                        return transDate(value, 'yyyy-MM-dd hh:mm:ss');
                    }
                },
                {
                    label: '操作', width: 60, align: 'center', sortable: false,
                    formatter: function (value, col, row) {
                        return "<div onclick='fileCommonHandle(\"" + row.url + "\", \"" + row.relName + "\")'><i class='fa fa-eye'></i>&nbsp;查看</div>"
                    }
                },
                { label: 'id', name: 'id', index: 'ID', key: true, hidden: true }
            ]
        });
    })
    ;
    /**
     * 维护履历
     */
    $(function () {
        $("#jqGrid2").Grid({
            url: '../modulemaintainrelate/list?moduleCode=' + moduleCode,
            colModel: [
                {label: '一级名称', name: 'moduleMaintainOption.optionSubclass', width: 60},
                {label: '二级名称', name: 'moduleMaintainOption.optionName', width: 60},
                {label: '方法手段', name: 'moduleMaintainOption.method', width: 80},
                {label: '检查标准', name: 'moduleMaintainOption.inspectStandard', width: 120},
                {label: '维护前', name: 'bmCheckResult', width: 40,
                    formatter: function (value) {
                        if(value=="null" || value==null){
                            return "暂无结果";
                        }else{
                            return sysEnums.MODULE_READY_STATUS[value];
                        }
                    }
                },
                {label: '维护后', name: 'amConfirmResult', width: 40,
                    formatter: function (value) {
                        if(value=="null" || value==null){
                            return "暂无结果";
                        }else{
                            return sysEnums.MODULE_READY_STATUS[value];
                        }
                    }
                },
                {
                    label: '实施时间', name: 'implementDate', index: 'IMPLEMENT_DATE', width: 80, formatter: function (value) {
                        return transDate(value, 'yyyy-MM-dd hh:mm')
                    }
                }
            ]
        });
    });
    /**
     * 维修履历
     */
    $(function () {
        $("#jqGrid3").Grid({
            url: '../modulerepairrocord/list?moduleCode=' + moduleCode,
            colModel: [
                {label: '报修编号', name: 'repairCode', index: 'REPAIR_CODE', width: 80},
                {name: 'subShop', hidden: true},
                {label: '报修人', name: 'reporter', index: 'REPORT', width: 60},
                {
                    label: '报修时间', name: 'repairDate', index: 'REPAIR_DATE', width: 80, formatter: function (value) {
                        return transDate(value, 'yyyy-MM-dd')
                    }
                },
                {
                    label: '工单状态', name: 'status', index: 'STATUS', width: 60,
                    formatter: function (value) {
                        return sysEnums.REPAIR_TICKET_STATUS[value];
                    }
                },
                {label: '故障类型', name: 'faultTypeName', index: 'FAULT_TYPE', width: 80},
                {label: '故障描述', name: 'recordDescr', index: 'RECORD_DESCR'},
                {label: '解决方案', name: 'solution', index: 'SOLUTION'},
                {
                    label: '同步知识库', name: 'synKnowledge', index: 'SYN_KNOWLEDGE', width: 60,
                    formatter: function (value) {
                        return sysEnums.IS_SYN[value];
                    }
                },
                {label: 'id', name: 'id', index: 'ID', key: true, hidden: true},
            ]
        });
    });
    /**
     * 型芯镶件更换
     */
    $("#jqGrid4").Grid({
        url: '../modulereplacepart/list?moduleCode='+moduleCode,
        colModel: [
            {label: '模具编码', name: 'moduleCode', index: 'MODULE_CODE',align : "center", width: 120},
            {label: '模具备件名称', name: 'fittingName', index: 'FITTING_NAME', width: 120},
            {label: '类型', name: 'type', index: 'TYPE',align : "center", width: 120},
            {
                label: '更换时间', name: 'replaceDate', index: 'REPLACE_DATE',align : "center", formatter: function (value) {
                    return transDate(value, 'yyyy-MM-dd');
                }
            },
            {label: '寿命标准', name: 'lifeStandard', index: 'LIFE_STANDARD',align : "center", width: 120},
            {label: '使用模次', name: 'useTime', index: 'USE_TIME',align : "center", width: 120},
            {label: '实际使用次数', name: 'realUseTime', index: 'REAL_USE_TIME', align : "center", width: 120},
            {label: '备注信息', name: 'remark', index: 'REMARK', width: 80},
            {label: 'id', name: 'id', index: 'ID', key: true, hidden: true},
        ]
    });
    /**
     * 车间移动
     */
    $("#jqGrid5").Grid({
        url: '../modulechangelog/list?moduleCode='+moduleCode,
        colModel: [
            {label: '模具号', name: 'moduleNo', index: 'MODULE_NO'},
            {label: '模具编码', name: 'moduleCode', index: 'MODULE_CODE'},
            {label: '操作人', name: 'author', index: 'AUTHOR'},
            {label: '新车间', name: 'subShopNow', index: 'SUB_SHOP_NOW'},
            {label: '原车间', name: 'subShopOld', index: 'SUB_SHOP_OLD'},
            /*{label: '备注信息', name: 'descn', index: 'DESCN', width: 80},*/
            {label: '操作时间', name: 'authorDate', index: 'AUTHOR_DATE',
                formatter: function (value) {
                    return transDate(value, 'yyyy-MM-dd');
                }},
            {label: 'id', name: 'id', index: 'ID', key: true, hidden: true},
        ]
    });

    let vm = new Vue({
        el: '#rrapp',
        data: {
            q: {
                name: ''
            },

            moduleArchives: {},
        },
        methods: {
            getInfo: function () {
                Ajax.request({
                    url: "../modulearchives/info/" + id,
                    async: true,
                    successCallback: function (r) {
                        console.log(
                            r.moduleArchives
                        )
                        vm.moduleArchives = r.moduleArchives;
                        vm.moduleArchives.startDate = transDate(r.moduleArchives.startDate, 'yyyy-MM-dd');
                        vm.moduleArchives.initialAcceptDate = transDate(r.moduleArchives.initialAcceptDate, 'yyyy-MM-dd');
                        vm.moduleArchives.finalAcceptDate = transDate(r.moduleArchives.finalAcceptDate, 'yyyy-MM-dd');
                        vm.moduleArchives.scrapDate = transDate(r.moduleArchives.scrapDate, 'yyyy-MM-dd');
                        vm.moduleArchives.currentState =sysEnums.MODULE_STATE[r.moduleArchives.currentState];
                        vm.moduleArchives.moduleCategory = sysEnums.MODULE_TYPE[r.moduleArchives.moduleCategory];
                        console.log(vm.moduleArchives)
                    }
                });
            },
            eyeFile: function (url) {
                if (url) {
                    window.open(url);
                } else {
                    alert('还未上传文件');
                }
            }
        }
    });
</script>
</body>
</html>
